{include file="public/layout" /}
<body class="eyou_body_xin">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
{include file="order/left" /}
<div id="geduan_div" class="h15"></div>
<div class="page {empty name='$web_shopcomment_switch'}on-off_show{/empty}" style="min-width:auto;margin-left:115px;padding-bottom: 15px;">
    <div class="fixed-bar">
        <div class="item-title mb0">
            <ul class="tab-base nc-row">
                <li><a href="{:url('ShopComment/comment_index')}" {if condition="'comment_index'==$Think.const.ACTION_NAME"}class="current"{/if}><span>评价列表</span></a></li>
            </ul>
        </div>
    </div>
    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
              <div class="fbutton" style="float: none;">
                   <a href="{:url('ShopComment/comment_add')}">
                       <div class="add">
                           <span><i class="layui-icon layui-icon-addition"></i>创建评价</span>
                       </div>
                   </a>
               </div>
           </div>
            <form class="navbar-form form-inline" id="searchForm" action="{:url('ShopComment/comment_index')}" method="get" onsubmit="layer_loading('正在处理');">
                {$searchform.hidden|default=''}
                <div class="sDiv">
                    <div class="sDiv2">
                        <input type="text" size="50" name="order_code" value="{$Request.param.order_code}" class="qsbox" style="width: 200px;" placeholder="搜索订单号..."> <input type="submit" class="btn" value="搜索"> <i class="iconfont e-sousuo"></i>
                    </div>
            
                </div>
            </form>
        </div>
    </div>
    <!-- <div class="geduan-xin"></div> -->
    <div class="flexigrid flexigrid-xin">
        <div class="tableDiv">
            <table cellspacing="0" cellpadding="0" class="wt100">
                <thead>
                    <tr>
                        <th class="sign w40" axis="col0"><div class="tc"><input type="checkbox" autocomplete="off" class="checkAll"></div></th>
                        <th align="center" abbr="article_title" axis="col3" class="w340"> <div class="">商品信息</div> </th>
                        <th abbr="" axis="col6"> <div class="">评价内容</div> </th>
                        <th abbr="" axis="col6" class="w60"> <div class="tc">来源</div> </th>
                        <th abbr="" axis="col6" class="w140"> <div class="tc">评价评分</div> </th>
                        <th abbr="" axis="col6" class="w140"> <div class="">用户名</div> </th>
                        <th abbr="" axis="col6" class="w60"> <div class="tc">审核</div> </th>
                        <th abbr="" axis="col6" class="w140"> <div class="tc">评价时间</div> </th>
                        <th axis="col1" class="w150"> <div class="tc">操作</div> </th>
                    </tr>
                </thead>
    
                <tbody>
                {empty name="Comment"}
                    <tr>
                        <td class="no-data" align="center" axis="col0" colspan="50">
                            <div class="no_row">
                                <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
                            </div>
                        </td>
                    </tr>
                {else/}
                    {volist name="Comment" id="vo"}
                    <tr class="order-empty"> <td colspan="8"></td> </tr>
                    <tr class="order-empty">
                        <td class="sign pl0">
                            <div class="tc"> <input type="checkbox" autocomplete="off" name="ids[]" value="{$vo.comment_id}"> </div>
                        </td>
                        <td>
                            <div class="goods-detail">
                                <div class="goods-image"><img src="{$vo.product_img}"></div>
                                <div class="goods-info"> <p class="goods-title">{$vo.product_name}</p> <p class="goods-spec">{$vo.product_spec}</p></div>
                            </div>
                        </td>
                        <td rowspan="1"><p class="list_evaluation_content w240">{$vo.content}</p></td>
                        <td class="" rowspan="1"><p class="tc">{eq name="$vo.systemComment" value="1"}手动{else/}客户{/eq}</p></td>
                        <td class="" rowspan="1"><p class="tc"><i class="z_comment-star z_star{$vo.total_score}"></i></p></td>
                        <td rowspan="1">
                            <p class="d-flex w140">
                                <img class="list_img_head_pic" src="{$vo.head_pic}" />
                                <a href="javascript:void(0);" data-href="{:url('Member/users_edit', array('id' => $vo['users_id'], 'iframe'=>1, 'layer'=>1))}" onclick="openFullframe(this, '用户资料', '100%', '100%');" class="l-height-24 w110 ellipsis"> {$vo.nickname|default=$vo.username} </a>
                            </p>
                        </td>
                        <td class="" rowspan="1">
                            <p class="tc">
                                {eq name="$vo['is_show']" value='1'}
                                    <span class="yes" onClick="changeTableVal('shop_order_comment', 'comment_id', '{$vo.comment_id}', 'is_show', this);"><i class="fa fa-check-circle"></i>是</span>
                                {else /}
                                    <span class="no" onClick="changeTableVal('shop_order_comment', 'comment_id', '{$vo.comment_id}', 'is_show', this);"><i class="fa fa-ban"></i>否</span>
                                {/eq}
                            </p>
                        </td>
                        <td class="" rowspan="1"> <div class="tc"> {$vo.add_time|MyDate='Y-m-d H:i:s',###} </div> </td>
                        <td class="" rowspan="1">
                            <div class="operation">
                                <a href="{:url('ShopComment/comment_details', array('comment_id' => $vo['comment_id']))}" class="bt">详情</a>
                                <i></i>
                                <a href="javascript:void(0);" data-id="{$vo.comment_id}" data-admin_reply="{$vo.admin_reply.adminReply}" data-reply_time="{$vo.admin_reply.replyTime}" onclick="commentAdminReply(this);" class="bt">回复{notempty name="$vo.admin_reply.adminReply"}<em class="num">!</em>{/notempty}</a>
                                <i></i>
                                <a href="javascript:void(0);" data-url="{:url('ShopComment/comment_del')}" data-id="{$vo.comment_id}" onclick="delfun(this);" class="bt">删除</a>
                            </div>
                        </td>
                    </tr>
                    {/volist}
                {/empty}
                </tbody>
            </table>
        </div>
        {notempty name="Comment"}
        <div class="tDiv">
            <div class="tDiv2">
                <div class="fbutton checkboxall">
                    <input type="checkbox" autocomplete="off" class="checkAll">
                </div>
                <div class="fbutton">
                    <a onclick="batch_del(this, 'ids');" data-url="{:url('ShopComment/comment_del')}" class="layui-btn layui-btn-primary"><span>批量删除</span></a>
                </div>
                {include file="public/page" /}
            </div>
            <div style="clear:both"></div>
        </div>
        {/notempty}
    </div>

</div>
<script type="text/javascript">
    $(function(){

        $(document).keydown(function(event){
            if (event.keyCode ==13) {
                $('#searchForm input[type=text]').each(function(index, item){
                    if ($(item).is(':focus')) {
                        $('#searchForm').submit();
                    }
                });
            }
        });
        
        $('input[name*=ids]').click(function(){
            if ($('input[name*=ids]').length == $('input[name*=ids]:checked').length) {
                $('.checkAll').prop('checked','checked');
            } else {
                $('.checkAll').prop('checked', false);
            }
        });
        $('input[type=checkbox].checkAll').click(function(){
            $('input[type=checkbox]').prop('checked',this.checked);
        });
    });

    $(document).ready(function(){
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });

        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });
    });

    function ajax_open_close(obj, inc_type, name,value) {
        $.ajax({
            type : 'post',
            url : $(obj).attr('data-url'),
            data : {value:$(obj).attr('data-value'), _ajax:1},
            dataType : 'json',
            success : function(res){
                if(res.code == 1){
                    window.location.reload();
                }else{
                    showErrorMsg(res.msg);
                }
            },
            error: function(e){
                showErrorAlert(e.responseText);
            }
        })
    }

    // 商家快捷回复
    function commentAdminReply(obj) {
        var commentID = $(obj).attr('data-id') ? $(obj).attr('data-id') : 0;
        var reply_time = $(obj).attr('data-reply_time') ? $(obj).attr('data-reply_time') : 0;
        var admin_reply = $(obj).attr('data-admin_reply') ? $(obj).attr('data-admin_reply') : '';
        layer.prompt({
            formType: 2,
            shade: layer_shade,
            value: admin_reply,
            title: '请填写商家回复',
            btnAlign:'r',
            closeBtn: 3,
            id: 'adminReply',
            btn: ['确定', '取消'],
            area: ['300px', '100px'],
            success: function(layero, index) {
                $(".layui-layer-content").css('text-align', 'left');
                // 回复框字数限制
                $("#adminReply").find('textarea').attr('maxlength', '280');
                // 回复框标题
                $("#adminReply").prepend(msg);
                // 回复框更新时间
                if (parseInt(reply_time) !== 0) {
                    var msg = '<br/><span style="color: #999; font-size: 12px;">最后更新：'+reply_time+'</span>';
                    $("#adminReply").append(msg);
                } 
            }
        }, function(adminReply, index, elem) {
            // 商家快捷回复
            addCommentAdminReply(commentID, adminReply);
            layer.close(index);
        });
    }

    // 商家快捷回复
    function addCommentAdminReply(commentID, adminReply) {
        $.ajax({
            type: 'post',
            url : "{:url('ShopComment/comment_admin_reply', ['_ajax'=>1])}",
            data: {comment_id: commentID, admin_reply: adminReply},
            dataType: 'json',
            success : function(res) {
                if (1 === parseInt(res.code)) {
                    window.location.reload();
                } else {
                    showErrorMsg(res.msg);
                }
            },
            error: function(e) {
                showErrorAlert(e.responseText);
            }
        });
    }
</script>

{include file="public/footer" /}
<script type="text/javascript">
    try{
        var mt20_1649209614 = sessionStorage.getItem("mt20_1649209614");
        if (mt20_1649209614 == 1){
            $("#geduan_div").removeClass("h15");
        } else {
            $("#geduan_div").addClass("h15");
        }
    }catch(e){}
</script>
